<template>
    <div id="app">
        <div v-if="isLogin">
            <router-view />
        </div>
        <el-container class="zhqcBox" v-else>
            <el-aside width="180px" class="lettbj">
                <zhqcAside v-if="$store.state.loginfo"></zhqcAside>
            </el-aside>
            <el-container>
                <el-header height="50">
                    <div class="pr">
                        <zhqcHeader></zhqcHeader>
                    </div>
                </el-header>
                <browsingHistory></browsingHistory>
                <el-main>
                    <keep-alive v-if="$store.state.keepAlive">
                        <router-view />
                    </keep-alive>
                    <router-view v-else/>
                </el-main>
            </el-container>
        </el-container>
    </div>
</template>
<script>
    import zhqcAside from '@/layout/zhqcAside'
    import zhqcHeader from '@/layout/zhqcHeader'
    import browsingHistory from '@/layout/browsingHistory'
    export default {
        data() {
            return {

            }
        },
        computed: {
            isLogin() {
                return this.$store.state.isLogin;
            }
        },
        components: {
            zhqcAside,
            zhqcHeader,
            browsingHistory
        },
        methods: {
            async getloginfo() {
                let res = await this.$api.zhqcpublic.getzhycloginInfo('/oauth/loginInfo')
                this.$store.state.loginfo = res
            }
        },
        mounted() {
            if (!this.$store.state.isLogin) {
                this.getloginfo()
            }
            console.log(this.$route);
        }

    }

</script>
<style>


</style>
